/* 
 * Since 2008 - 2012
 */

package com.hh.bss.sysadmin.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.hh.bss.base.BaseHibernateDao;
import com.hh.bss.common.MapObjectRowMapper;
import com.hh.bss.common.page.Page;
import com.hh.bss.sysadmin.dao.SystemDicMapDao;
import com.hh.bss.sysadmin.entity.SystemDicMap;
import com.hh.bss.sysadmin.vo.query.SystemDicMapQuery;

@Repository
public class SystemDicMapDaoImpl extends BaseHibernateDao<SystemDicMap, java.lang.Integer> implements SystemDicMapDao<SystemDicMap, java.lang.Integer> {

	public Class getEntityClass() {
		return SystemDicMap.class;
	}

	public Page findPage(SystemDicMapQuery query) {
		logger.info("SystemDicMap Dao 调用了....");
		StringBuffer sql = new StringBuffer();
		List values = new ArrayList();

		sql.append(" select * from ( ");
		sql.append(" select a.id,a.category,a.key_id keyId,a.key_map_ids keyMapIds from system_dic_map a where 1=1 and a.status = 'A' ");
		sql.append(" )  dicMap where 1=1 ");
		// return null;
		return super.getJdbcDao().createPage(sql.toString(), values.toArray(), new MapObjectRowMapper(), query.getPageSize(), query.getPageNumber());
	}

	public List getAllDicMap(SystemDicMapQuery query) {
		StringBuffer sql = new StringBuffer();
		sql.append(" select * from ( ");
		sql.append(" select a.id,a.category,a.key_id keyId,a.key_map_ids keyMapIds from system_dic_map a where 1=1 and a.status = 'A' ");
		sql.append(" )  dicMap where 1=1 ");
		
		return this.getJdbcDao().findByQuery(sql.toString(), new MapObjectRowMapper());

	}

}
